
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.*


/**
 * @Author LD
 * @Time 2021/3/3 17:01
 * @Describe 上传文件接口
 *https://www.jianshu.com/p/3826f7e2e4c7
 * https://www.jianshu.com/p/74b7da380855
 * @Modify
 */
interface UploadService {

    /**
     * 单个文件上传,传完整地址
     */
    @Multipart
    @POST
    open fun uploadFile(@Url url: String,@Part multipartBody: MultipartBody.Part): Call<ResponseBody>

    /**
     * 单个文件上传,传相对地址
     */
    @Multipart
    @POST("{param}")
    open fun uploadFile2(@Path("param", encoded = true) param: String, @Part multipartBody: MultipartBody.Part): Call<ResponseBody>

//    @Multipart
//    @POST("/myfittinglife/uploadfile")
//    open fun uploadFile(@Part multipartBody: MultipartBody.Part): Call<ProgressResponseBody>

    /**
     * 多个文件上传myfittinglife/uploadfiles
     */
    @Multipart
    @POST
    open fun uploadFiles(@Url url: String,@Part list: List<MultipartBody.Part>): Call<ResponseBody>

    /**
     * 传相对地址
     */
    @Multipart
    @POST("{param}")
    open fun uploadFiles2(@Path("param", encoded = true) param: String,@Part list: List<MultipartBody.Part>): Call<ResponseBody>
}